$(function(){
	//显示学院下教室
	$('.classroom-show').on('click',function(){
		$(this).parents('tbody').find('.organization-classroom').toggle()
	})
	
	//显示管理员
	$('.classroom-add-admin').on('click',function(){
	    var org_uuid = $(this).parent().parent().attr("data-id");
	    $(".add-admin-btn").attr("data-id", org_uuid);
	    var admins = get_org_admins(org_uuid)
	    for(n in admins[0]){
	         $(".admin-list").append("<li id="+ admins[0][n].user_uuid +" >" + admins[0][n].user_name + "<span class='delete-admin'>删除</span></li>")
	    }
        $.getScript('/static/js/delete-user.js');
		$('.alert-ccc').show();
		$('.organ-admin').show();
	})
	$('.argan-admin-no').on('click',function(){
		$('.alert-ccc').hide();
		$('.organ-admin').hide();
        $("#admin-user-name").val("");
        $("#admin-user-login").val("");
        $("#admin-user-password").val("");
        $(".admin-list").html("");
	})
	$('.argan-admin-yes').on('click',function(){
		$('.alert-ccc').hide();
		$('.organ-admin').hide();
        $("#admin-user-name").val("");
        $("#admin-user-login").val("");
        $("#admin-user-password").val("");
        $(".admin-list").html("");
	})
	//新增管理员
//	$('.add-admin-btn').on('click',function(){
//		if($('.add-admin-text').val()){
//			$('.admin-list').append('<li>'+$('.add-admin-text').val()+'<span>删除</span></li>')
//		}
//	})
	
	//新增机构
	$('.add-organization').on('click',function(){
		$('.add-organization-box').show()
		$('.alert-ccc').show();
	})
	$('.add-organ-no').on('click',function(){
		$('.add-organization-box').hide()
		$('.alert-ccc').hide();		
	})
	
	//修改
	$('.organization-list-main').on('click','span.modification-span',function(){
		$('.modification-organization-box').show();
		$('.alert-ccc').show();
	})
	$('.modification-organ-no').on('click',function(){
		$('.modification-organization-box').hide();
		$('.alert-ccc').hide();		
	})
})
